package com.controller;

import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.beans.TeamInfo;
import com.service.TeamService;
@Controller  @RequestMapping("/team")
public class TeamController {
	@Resource
	private TeamService teamService;
	
	
	//全局的,用于转向某个页面
	@GetMapping("/{page}")
	public String toPage(@PathVariable("page") String page) {
		return page;   //默认会转向 src/main/resources/templates/+page+.html
	}
	
	//添加组员
	@PostMapping("/add")
	public String add(TeamInfo user,ModelMap m)
	{
		teamService.addTeam(user);
		m.put("msg","添加成功");
		return "team-add";
	}
}
